﻿@model IList<BusinessObjects.Project>
@{
    ViewBag.Title = "Проекты";
}
<h2>
    Текущие проекты</h2>
<table>
    <tr>
        <td>
            <b>Название</b>
        </td>
        <td>
            <b>Описание</b>
        </td>
        <td>
            <b>Ответственный</b>
        </td>
        @if (User.IsInRole("ProjectManager"))
        {
            <td>
                <b>Действия</b>
            </td>
        }
    </tr>
    @foreach (BusinessObjects.Project project in Model)
    {
        <tr>
            <td>
                @Html.ActionLink(@project.Title, "ViewDetails", new { id = project.ProjectId })
            </td>
            <td>
                @String.Format("{0}", project.Description)
            </td>
            <td>
                @String.Format("{0} {1}", project.Officer.LastName, project.Officer.FirstName)
            </td>
            @if (User.IsInRole("ProjectManager"))
            {
                <td>
                    @Html.ActionLink("Удалить", "Delete", new { id = project.ProjectId })
                </td>
            }
        </tr>
    }
</table>
@if (User.IsInRole("ProjectManager"))
{
    <p>@Html.ActionLink("Добавить проект", "Create")</p>
}
